home *** CD-ROM | disk | FTP | other *** search
- .\" XXX standard disclaimer belongs here....
- .\" $Header: /private/postgres/ref/postquel/RCS/create,v 1.8 1992/07/14 05:54:17 ptong Exp $
- .SP CREATE COMMANDS 6/14/90
- .XA 2 Create
- .uh NAME
- .lp
- create \*- create a new class
- .uh SYNOPSIS
- .lp
- .(l
- \fBcreate\fR classname (attributename = type { , attributename = type})
- [\fBkey\fR (attributename [[\fBusing\fR] \fBoperator\fR]
- { , attributename [[\fBusing\fR] \fBoperator\fR] } )]
- [\fBinherits\fR \fB(\fR classname {\fB,\fR classname} \fB)\fR]
- [\fBarchive\fR \fB=\fR archive_mode]
- [\fBstore\fR \fB=\fR ``smgr name'']
- [\fBarch_store\fR \fB=\fR ``smgr name'']
- .)l
- .uh DESCRIPTION
- .lp
- .b Create
- will enter a new class into the current data base.
- The class will be
- .q "owned"
- by the user issuing the command.
- The name of the class is
- \fIclassname\fR
- and the attributes are as specified in the list of
- \fIattributenames:\fR
- \fIattributename, attributename,\fR
- etc.
- The attributes are created with the type specified by
- \fItype.\fR
- .lp
- The \fIkey\fR clause is used to specify that a field or a collection
- of fields is unique.
- If no key clause is specified, \*(PP will still give every instance
- a unique object-id
- .r ( \c
- .A OID ).
- This clause allows other fields to be additional keys.
- Moreover, the
- .q "using operator"
- part of the clause allows the user to specify what operator should
- be used for the uniqueness test.
- For example, integers are all unique if = is used for
- the check, but not if < is used instead.
- If no operator is specified, = is used by default.
- Any specified operator must be a binary operator returning a boolean.
- If there is no compatible index to allow the key clause to be
- rapidly checked, \*(PP defaults to not checking
- rather than performing an exhaustive search on each key update.
- .lp
- The
- \fIinherits\fR
- clause specifies a collection of class names
- from which this class automatically inherits all fields.
- If any inherited field name appears more than once,
- \*(PP reports an error.
- Moreover,
- \*(PP automatically allows the created class to inherit
- functions on classes above it in the
- inheritance hierarchy.
- Inheritance of functions is done according to the conventions of the
- Common Lisp Object System (CLOS).
- .lp
- In addition,
- .i classname
- is automatically created as a type. Therefore, one or more instances
- from the class are automatically a type and can be used in
- addattr or other create statements.
- See
- .b introduction
- (commands) for a further discussion of this point.
- .lp
- The
- .i store
- and
- .i arch_store
- keywords may be used to specify a storage manager to use
- for the new class.
- The released version of \*(PP supports only ``magnetic disk''
- as a storage manager name;
- the research system at Berkeley provides additional storage managers.
- .i Store
- controls the location of current data,
- and
- .i arch_store
- controls the location of historical data.
- .i Arch_store
- may only be specified if
- .i archive
- is also specified.
- If either
- .i store
- or
- .i arch_store
- is not declared,
- it defaults to ``magnetic disk.''
- .lp
- The class is created as a heap with
- no initial data.
- A class can have no more than 1600 domains (realistically,
- this is limited by the fact that tuple sizes must be less
- than 8K),
- but this limit may be configured lower at some sites.
- A class cannot have the same name as
- a system catalog class.
- .lp
- .i Archive
- specifies whether historical data is to be saved or discarded.
- .i Arch_mode
- may be one of:
- .(l
- none: no historical access is supported
- light: historical access is allowed and optimized for light update activity
- heavy: historical access is allowed and optimized for heavy update activity
- .)l
- and defaults to none.
- For details of the optimization, see
- [STON87].
- Once the archive status is set, there is no way to change it.
- .uh EXAMPLE
- .lp
- .nf
- .ft C
- .sp
- /* Create class emp with attributes name, sal and bdate */
-
- create emp (name = char16, salary = float4, bdate = abstime)
- .ft
- .lp
- .nf
- .ft C
- .sp
- /* Create class permemp with pension information
- * inheriting all fields of emp */
-
- create permemp (plan = char16) inherits (emp)
- .ft
- .lp
- .nf
- .ft C
- .sp
- /* Create a class foo on mag disk,
- * and archive historical data */
-
- create foo (bar = int4) archive = heavy
- store = "magnetic disk"
- .ft
- .fi
- .uh "SEE ALSO"
- .lp
- destroy(commands).
- .uh BUGS
- .lp
- Key is not implemented in Version \*(PV.
- .lp
- Optional specifications (inherits, archive, store)
- must be supplied in the order given above, if they are supplied at all.
-